#include <iostream>
#include <functional>
#include <atomic>

using namespace std;

class FooBar
{
private:
    int n;
    atomic<int> flag = 0;

public:
    FooBar(int n)
    {
        this->n = n;
    }

    void foo(function<void()> printFoo)
    {

        for (int i = 0; i < n; i++)
        {
            while (flag.load() != 0)
                ;
            // printFoo() outputs "foo". Do not change or remove this line.
            printFoo();
            flag++;
        }
    }

    void bar(function<void()> printBar)
    {

        for (int i = 0; i < n; i++)
        {
            while (flag.load() != 1)
                ;
            // printBar() outputs "bar". Do not change or remove this line.
            printBar();
            flag--;
        }
    }
};

int main()
{
    cout << "Code1115" << endl;
    Solution s;
    return 0;
}